#pragma once
#include "LightningDefine.h"

// CMaintainDlg dialog
#define					TIMER_SHOW_CONNECNT				10001
#define					WM_BTN_INPUT_OUT_CLICK			WM_USER + 200 
#define					TIMER_FLICKER					1000
#define					IDC_BTN_INPUT_0					1800
#define					IDC_BTN_OUTPUT_0				1900

class CMaintainDlg : public CDialogEx
{
	DECLARE_DYNAMIC(CMaintainDlg)

public:
	CMaintainDlg(CWnd* pParent = NULL);   // standard constructor
	virtual ~CMaintainDlg();

// Dialog Data
	enum { IDD = IDD_IO_MAIN_CTR_DLG };

	HICON m_hIcon;
	int m_nOutputNum, m_nInputNum;
	CIconButton m_btnInput[100], m_btnOutput[100];
	CIconButton m_btnAixALM[4], m_btnAixPEL[4],\
		m_btnAixNEL[4], m_btnAixOrg[4], m_btnAixSevon[4],\
		m_btnAixMoving[4], m_btnEmg, m_btnAixHome[4];

	CToolTipCtrl * m_pToolTipCtl;
	CGdiPlusSkinButton m_btnUp, m_btnDown, m_btnLeft, m_btnRight, m_btnMove;	
	CGdiPlusSkinButton m_btnPLCInit;

	bool m_bThreadFlag, m_bThreadEnd;
	void Refresh();
	void UpdatePos();
	void InitButton();
protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

	DECLARE_MESSAGE_MAP()
public:
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	afx_msg LRESULT OnInputOutClick(WPARAM wParam, LPARAM lParam);
	virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
	virtual BOOL OnInitDialog();
	afx_msg void OnTimer(UINT_PTR nIDEvent);
	afx_msg void OnBnClickedButtonAixUp();
	afx_msg void OnBnClickedButtonAixDown();
	afx_msg void OnBnClickedButtonAixLeft();
	afx_msg void OnBnClickedButtonAixRight();
	afx_msg void OnBnClickedButtonAixMove();
	afx_msg void OnClose();
	afx_msg void OnBnClickedButton1();
	afx_msg void OnBnClickedButton2();
	afx_msg void OnBnClickedButton3();
	afx_msg void OnBnClickedButton4();
	afx_msg void OnBnClickedBtn26();
	afx_msg void OnBnClickedBtn28();
	afx_msg void OnBnClickedBtnSpeed();
};
